package customerEnter.Frame.filterDataTransmission;

import java.util.HashMap;
import java.util.Map;

import customerEnter.tool.WhetherToEmpty;

 
public class IpRecord {

	private static Map<String, Long>	setMap;
	private static Map<String, String>	setTimeMap;
	private static IpRecord				ipRecord;

	public static IpRecord getIpRecord() {
		if (WhetherToEmpty.ObjectWhetherToEmpty(ipRecord)) {
			ipRecord = new IpRecord();
		}
		initMap();
		initMapTime();
		return ipRecord;
	}

	private static void initMap() {
		if (WhetherToEmpty.ObjectWhetherToEmpty(setMap)) {
			setMap = new HashMap<String, Long>();
		}
	}

	private static void initMapTime() {
		if (WhetherToEmpty.ObjectWhetherToEmpty(setTimeMap)) {
			setTimeMap = new HashMap<String, String>();
		}

	}

	public void setIpRecord(String ip, Long ipRequestTimems, String ipRequestTime) {
		setMap.put(ip, ipRequestTimems);
		setTimeMap.put(ip, ipRequestTime);
	}

	public Long getIpRecord(String ip) {
		return setMap.get(ip);
	}

	public void ClearIpRecord() {
		setMap.clear();
	}

	public String getIpRecordTime(String ip) {
		return setTimeMap.get(ip);
	}

	public void ClearIpRecordTime() {
		setTimeMap.clear();
	}
}
